/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;

/**
 * 整数类型的注释元素表示一个逻辑类型，并且它的值应该是明确命名的常量之一。
 *
 * 如果{@link #flag（）}属性设置为true，则可以组合多个常量
 * Example:
 * <pre>{@code
 *  Retention(CLASS)
 *  IntDef(NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS)
 *  public interface NavigationMode 
 *  public static final int NAVIGATION_MODE_STANDARD = 0;
 *  public static final int NAVIGATION_MODE_LIST = 1;
 *  public static final int NAVIGATION_MODE_TABS = 2;
 *  ...
 *  public abstract void setNavigationMode(NavigationMode int mode);
 *  NavigationMode
 *  public abstract int getNavigationMode();
 * }</pre>
 *
 * 对于一个标志，设置标志属性：
 * <pre>{@code
 *  IntDef(
 *      flag = true
 *      value = NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS)
 * }</pre>
 *
 * @hide
 *
 */
@Retention(CLASS)
//ANNOTATION_TYPE:注释类型
@Target({ANNOTATION_TYPE})

public @interface IntDef {
    /**
     * 定义此元素的允许常量
     * */
    long[] value() default {};

    /**
     * 定义常量是可以用作一个标志，还是仅仅作为一个枚举（默认）
     * */
    boolean flag() default false;
}
